<?php
	/**
	 * @package AmpleHarvest
	 */
	use\ampleharvest\code;
	/**
	 * Includes Path Info Class
	 */
	require_once(dirname(dirname(__FILE__))) . '/config/cConfig.php';
	$codeConfig = new \ampleharvest\code\cConfig();
	/**
	 * Includes the base class for databases( based on the path info found in the cCodeInfo.php file)
	 */
	require_once $codeConfig->C_STR_DATABASE_LIB_PATH . "/Classes/cDatabase.php";
	/**
	 * Includes the base class for the Saved Queries Table
	 */
	require_once "Tables/cTABLE_Data.php";
	//require_once "Tables/cTABLE_Data_Ref.php";
	require_once "Tables/cTABLE_Saved_Queries.php";
	//	require_once "Tables/cTABLE_Last_Indexed.php";
	require_once "Tables/cTABLE_Log.php";
	require_once "Tables/cTABLE_Query_History.php";
	require_once "Tables/cTABLE_Drop_Down.php";
	require_once "Tables/cTABLE_Drop_Down_Options.php";
	require_once "Tables/cTABLE_Harvest_Requests.php";
	require_once "Tables/cTABLE_IRT.php";
	require_once "Tables/cTABLE_IRT_Comments.php";
	require_once "Tables/cTABLE_Metric.php";
	require_once "Tables/cTABLE_SourceList.php";
	require_once "Tables/cTABLE_GroupPermissions.php";
	require_once "Tables/cTABLE_Secondary_Data.php";
	require_once "Tables/cTABLE_UserGroups.php";
	require_once "Tables/cTABLE_GroupOptions.php";
	require_once "Tables/cTABLE_GroupTags.php";
	
	
	require_once "viewes/cView_HarvestRequests.php";
	/**
	 * @brief This Class to hold information on createing the AmpleHarvest Database
	 *
	 * - Revision History
	 *  - 0.1
	 * 	 - <b>Date</b>: 24 MAR 2011
	 * 	 - <b>Author</b>: Randy Blancett
	 * 	  - Initial Version
	 *
	 * @author Randy Blancett
	 * @version 0.1
	 * @ingroup code classes db
	 */
	class cAmpleHarvest_DB extends cDatabase
	{
		/**
		 * Index to the Actions Table
		 */
		public $m_int_TABLE_Data;
		//public $m_int_TABLE_Data_Ref;
		public $m_int_TABLE_Drop_Down;
		public $m_int_TABLE_Drop_Down_Options;
		public $m_int_TABLE_Saved_Queries;
		//public $m_int_TABLE_Last_Indexed;
		public $m_int_TABLE_Log;
		public $m_int_TABLE_Query_History;
		public $m_int_TABLE_Harvest_Requests;
		public $m_int_TABLE_IRT;
		public $m_int_TABLE_IRT_Comments;
		public $m_int_TABLE_Metric;
		public $m_int_TABLE_SourceList;
		public $m_int_TABLE_GroupPermissions;
		public $m_int_TABLE_GroupOptions;
		public $m_int_TABLE_UserGroups;
		public $m_int_TABLE_Secondary_Data;
		public $m_int_TABLE_GroupTags;
		
		
		public $m_int_VIEW_HarvestRequests;

		/**
		 * Describes default information about the Database
		 */
		public function __construct()
		{
			$this->m_str_DBName = "ampleharvest";

			//Initialize Tables

			$obj_Table_Data = new cTABLE_Data();
			$this->m_int_TABLE_Data = $this->add_Table($obj_Table_Data);

			//$obj_Table_Data_Ref = new cTABLE_Data_Ref();
			//$this->m_int_TABLE_Data_Ref = $this->add_Table($obj_Table_Data_Ref);

			$obj_Table_Saved_Queries = new cTABLE_Saved_Queries();
			$this->m_int_TABLE_Saved_Queries = $this->add_Table($obj_Table_Saved_Queries);

			//			$obj_Table_Last_Indexed = new cTABLE_Last_Indexed();
			//			$this->m_int_TABLE_Last_Indexed = $this->add_Table($obj_Table_Last_Indexed);

			$obj_Table_Log = new cTABLE_Log();
			$this->m_int_TABLE_Log = $this->add_Table($obj_Table_Log);

			$obj_Table_Query_History = new cTABLE_Query_History();
			$this->m_int_TABLE_Query_History = $this->add_Table($obj_Table_Query_History);

			$obj_Table_Drop_Down_Options = new cTABLE_Drop_Down_Options();
			$this->m_int_TABLE_Drop_Down_Options = $this->add_Table($obj_Table_Drop_Down_Options);

			$obj_Table_Drop_Down = new cTABLE_Drop_Down();
			$this->m_int_TABLE_Drop_Down = $this->add_Table($obj_Table_Drop_Down);

			$obj_Table_Harvest_Requests = new cTABLE_Harvest_Requests();
			$this->m_int_TABLE_Harvest_Requests = $this->add_Table($obj_Table_Harvest_Requests);
			
			$obj_Table_IRT = new cTABLE_IRT();
			$this->m_int_TABLE_IRT = $this->add_Table($obj_Table_IRT);

			$obj_Table_IRT_Comments = new cTABLE_IRT_Comments();
			$this->m_int_TABLE_IRT_Comments = $this->add_Table($obj_Table_IRT_Comments);
			
			$obj_Table_Secondary_Data = new cTABLE_Secondary_Data();
			$this->m_int_TABLE_Secondary_Data = $this->add_Table($obj_Table_Secondary_Data);
		
			$obj_Table_Metric = new cTABLE_Metric();
			$this->m_int_TABLE_Metric = $this->add_Table($obj_Table_Metric);

			$obj_Table_SourceList = new cTABLE_SourceList();
			$this->m_int_TABLE_SourceList = $this->add_Table($obj_Table_SourceList);

			$obj_Table_GroupPermissions = new cTABLE_GroupPermissions();
			$this->m_int_TABLE_GroupPermissions = $this->add_Table($obj_Table_GroupPermissions);

			$obj_Table_UserGroups = new cTABLE_UserGroups();
			$this->m_int_TABLE_UserGroups = $this->add_Table($obj_Table_UserGroups);

			$obj_Table_GroupOptions = new cTABLE_GroupOptions();
			$this->m_int_TABLE_GroupOptions = $this->add_Table($obj_Table_GroupOptions);

			$obj_Table_GroupTags = new cTABLE_GroupTags();
			$this->m_int_TABLE_GroupTags = $this->add_Table($obj_Table_GroupTags);
			
			
			$obj_View_HarvestRequests = new cView_HarvestRequests();
			$this->m_int_VIEW_HarvestRequests = $this->add_View($obj_View_HarvestRequests);

			//Set up connection
			$this->m_obj_Connection = new cConnection("AmpleHarvest", "admin");
			//Activate all Debug options
			$this->m_obj_Connection->set_DebugLevel(cLog_Connection_Debug::c_int_LEVEL_BASIC);
			$this->m_obj_Connection->set_LogLevel(cLog_Connection::c_int_LEVEL_BASIC);
			$this->m_obj_Connection->activate_Logging();
			$this->m_obj_Connection->activate_LogDebug();
			//$this->m_obj_Connection->activate_ScreenDebug();
		}
	}
